<div id="hotels-placeholder">
	<!-- VERY Unfinished -->
    <div id="wrap" class="clearfix">

        <div id="aside">
		<? $this->load->view('destinations/parts/banner') ?>
		<? $this->load->view('rentacar/parts/map_box') ?>
        </div><!-- / Aside -->

        <div id="main">

            <? $total_res=count($destinations); ?>
            <div class="title title-search no-line">
                <p class="float-left"><?= lang('search.found') ?> <?= $total_res ?> <?= lang('search.results') ?><? if($this->lang->lang() == 'en' && $total_res > 1) echo's'; ?></p>
                <h1><?= isset($_GET['dest_hot']) && trim($_GET['dest_hot']) != '' ? lang('search.search.results') : lang('search.search.results.clean') ?></h1>
            </div>

            <div class="search-list accomodation-list clearfix">

                <?
                    $i=1;
					$pageSize = 10;
					$pageIndex = 0;
					$offset = 0;
					$hasPager = false;
					if(isset($_GET['p'])) {
						$pageIndex = intval($_GET['p']) - 1;
						$offset = $pageIndex * $pageSize;
					}
                    if($destinations)
						{
						$destinationCount = count($destinations);
						if($destinationCount > $pageSize) {
							$destinations = array_slice($destinations, $offset, $pageSize, true);
							$hasPager = true;
						}
                        foreach($destinations as $destination):
                                $link=base_url('destinations/'.urlify::filter($destination->name).'-'.$destination->ID);
                                $bt_title=lang('destination.details');
                            ?>
                            <div class="car-box">
                                <a href="<?= $link ?>"> 

                                    <? $thumbnail=$host_url.'gallery/destinations/'.$destination->photo_path.'/thumb_120x86/'.$destination->photo_name; ?>

                                    <img src="<?= $thumbnail ?>" alt="<?= $destination->name ?>" title="<?= $destination->name ?>" /> 

                                </a>
                                <div class="details">
                                        <?
										$pices = explode(" ",$destination->name);
                                                ?>
                                    <h2><a href="<?= $link ?>"><span><?=$pices[0]?></span><?
														for($j=1;$j<=count($pices)-1;$j++){
															echo ' '.$pices[$j];
														}
												?></a>
                                    </h2>

                                    <p><?= clean_html($destination->information) ?></p>

                                    <a href="<?= $link ?>" class="button"><?= $bt_title ?> &raquo;</a>

                                </div>
                            </div> <!--/ Item -->

                            <?
                            $i++;
                        endforeach;
                ?>
				<!-- pager -->
				<? if($hasPager) { 
					$pages = ceil($destinationCount / 10);
					//if($destinationCount % 10 == 0) {
					//	$pages--;
					//}
				?>
					<div class='pager'>
						<? if($pageIndex == 0) { ?>
							<a class='prev'>&laquo;</a>
						<? } else { ?>
							<a class='prev' href="<?= $pageIndex == 1 ? base_url('destinations') : base_url('destinations') . '?p=' . $pageIndex ?>">&laquo;</a>
						<? } 
						for($i= 0; $i < $pages; $i++) { 
							if($i == $pageIndex) { ?>
								<a class='page current'><?= ($i + 1) ?></a>
							<? } else { ?>
								<a class='page' href="<?= $i == 0 ? base_url('destinations') : base_url('destinations') . '?p=' . ($i + 1) ?>"><?= ($i + 1) ?></a>
							<? }
						}
						
						if($pageIndex == $pages - 1) { ?>
							<a class='next'>&raquo;</a>
						<? } else { ?>
							<a class='next' href="<?= base_url('destinations') . '?p=' . ($pageIndex + 2) ?>">&raquo;</a>
						<? } ?>
					</div>
				<? } ?>
				<!-- /pager -->
				<? } ?>
				
            </div><!-- / Three Columns -->
			

            <div class="two-columns clearfix">
                <? $this->load->view('parts/two_column') ?>
            </div>

        </div><!-- / Main -->


    </div><!-- / Wrap -->

</div>